<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /fasttmp/mkdist-qt-4.3.5-1211793125/qtopia-core-opensource-src-4.3.5/src/gui/widgets/qdial.cpp -->
<head>
  <title>Qt 4.3: QDial Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
<td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 align="center">QDial Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1>
<p>The QDial class provides a rounded range control (like a speedometer or potentiometer). <a href="#details">More...</a></p>
<pre> #include &lt;QDial&gt;</pre><p>Inherits <a href="qabstractslider.html">QAbstractSlider</a>.</p>
<ul>
<li><a href="qdial-members.html">List of all members, including inherited members</a></li>
<li><a href="qdial-qt3.html">Qt 3 support members</a></li>
</ul>
<a name="properties"></a>
<h3>Properties</h3>
<ul>
<li><div class="fn"/><b><a href="qdial.html#notchSize-prop">notchSize</a></b> : const int</li>
<li><div class="fn"/><b><a href="qdial.html#notchTarget-prop">notchTarget</a></b> : qreal</li>
<li><div class="fn"/><b><a href="qdial.html#notchesVisible-prop">notchesVisible</a></b> : bool</li>
<li><div class="fn"/><b><a href="qdial.html#wrapping-prop">wrapping</a></b> : bool</li>
</ul>
<ul>
<li><div class="fn"/>11 properties inherited from <a href="qabstractslider.html#properties">QAbstractSlider</a></li>
<li><div class="fn"/>56 properties inherited from <a href="qwidget.html#properties">QWidget</a></li>
<li><div class="fn"/>1 property inherited from <a href="qobject.html#properties">QObject</a></li>
</ul>
<a name="public-functions"></a>
<h3>Public Functions</h3>
<ul>
<li><div class="fn"/><b><a href="qdial.html#QDial">QDial</a></b> ( QWidget * <i>parent</i> = 0 )</li>
<li><div class="fn"/><b><a href="qdial.html#dtor.QDial">~QDial</a></b> ()</li>
<li><div class="fn"/>int <b><a href="qdial.html#notchSize-prop">notchSize</a></b> () const</li>
<li><div class="fn"/>qreal <b><a href="qdial.html#notchTarget-prop">notchTarget</a></b> () const</li>
<li><div class="fn"/>bool <b><a href="qdial.html#notchesVisible-prop">notchesVisible</a></b> () const</li>
<li><div class="fn"/>void <b><a href="qdial.html#notchTarget-prop">setNotchTarget</a></b> ( double <i>target</i> )</li>
<li><div class="fn"/>bool <b><a href="qdial.html#wrapping-prop">wrapping</a></b> () const</li>
</ul>
<ul>
<li><div class="fn"/>22 public functions inherited from <a href="qabstractslider.html#public-functions">QAbstractSlider</a></li>
<li><div class="fn"/>201 public functions inherited from <a href="qwidget.html#public-functions">QWidget</a></li>
<li><div class="fn"/>29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
<li><div class="fn"/>12 public functions inherited from <a href="qpaintdevice.html#public-functions">QPaintDevice</a></li>
</ul>
<a name="public-slots"></a>
<h3>Public Slots</h3>
<ul>
<li><div class="fn"/>void <b><a href="qdial.html#notchesVisible-prop">setNotchesVisible</a></b> ( bool <i>visible</i> )</li>
<li><div class="fn"/>void <b><a href="qdial.html#wrapping-prop">setWrapping</a></b> ( bool <i>on</i> )</li>
</ul>
<ul>
<li><div class="fn"/>2 public slots inherited from <a href="qabstractslider.html#public-slots">QAbstractSlider</a></li>
<li><div class="fn"/>19 public slots inherited from <a href="qwidget.html#public-slots">QWidget</a></li>
<li><div class="fn"/>1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
</ul>
<a name="protected-functions"></a>
<h3>Protected Functions</h3>
<ul>
<li><div class="fn"/>void <b><a href="qdial.html#initStyleOption">initStyleOption</a></b> ( QStyleOptionSlider * <i>option</i> ) const</li>
</ul>
<ul>
<li><div class="fn"/>3 protected functions inherited from <a href="qabstractslider.html#protected-functions">QAbstractSlider</a></li>
<li><div class="fn"/>38 protected functions inherited from <a href="qwidget.html#protected-functions">QWidget</a></li>
<li><div class="fn"/>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
<li><div class="fn"/>1 protected function inherited from <a href="qpaintdevice.html#protected-functions">QPaintDevice</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li><div class="fn"/>6 signals inherited from <a href="qabstractslider.html#signals">QAbstractSlider</a></li>
<li><div class="fn"/>1 signal inherited from <a href="qwidget.html#signals">QWidget</a></li>
<li><div class="fn"/>1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
<li><div class="fn"/>4 static public members inherited from <a href="qwidget.html#static-public-members">QWidget</a></li>
<li><div class="fn"/>5 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
<li><div class="fn"/>1 protected slot inherited from <a href="qwidget.html#protected-slots">QWidget</a></li>
</ul>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QDial class provides a rounded range control (like a speedometer or potentiometer).</p>
<p>QDial is used when the user needs to control a value within a program-definable range, and the range either wraps around (for example, with angles measured from 0 to 359 degrees) or the dialog layout needs a square widget.</p>
<p>Since QDial inherits from <a href="qabstractslider.html">QAbstractSlider</a>, the dial behaves in a similar way to a <a href="qslider.html">slider</a>. When <a href="qdial.html#wrapping-prop">wrapping</a>() is false (the default setting) there is no real difference between a slider and a dial. They both share the same signals, slots and member functions. Which one you use depends on the expectations of your users and on the type of application.</p>
<p>The dial initially emits <a href="qabstractslider.html#valueChanged">valueChanged</a>() signals continuously while the slider is being moved; you can make it emit the signal less often by disabling the <a href="qabstractslider.html#tracking-prop">tracking</a> property. The <a href="qabstractslider.html#sliderMoved">sliderMoved</a>() signal is emitted continuously even when tracking is disabled.</p>
<p>The dial also emits <a href="qabstractslider.html#sliderPressed">sliderPressed</a>() and <a href="qabstractslider.html#sliderReleased">sliderReleased</a>() signals when the mouse button is pressed and released. Note that the dial's value can change without these signals being emitted since the keyboard and wheel can also be used to change the value.</p>
<p>Unlike the slider, QDial attempts to draw a &quot;nice&quot; number of notches rather than one per line step. If possible, the number of notches drawn is one per line step, but if there aren't enough pixels to draw every one, QDial will skip notches to try and draw a uniform set (e.g&#x2e; by drawing every second or third notch).</p>
<p>Like the slider, the dial makes the <a href="qabstractslider.html">QAbstractSlider</a> functions <a href="qabstractslider.html#value-prop">setValue</a>(), <a href="qabstractslider-qt3.html#addLine">addLine</a>(), <a href="qabstractslider-qt3.html#subtractLine">subtractLine</a>(), <a href="qabstractslider-qt3.html#addPage">addPage</a>() and <a href="qabstractslider-qt3.html#subtractPage">subtractPage</a>() available as slots.</p>
<p>The dial's keyboard interface is fairly simple: The <b>left</b>/<b>up</b> and <b>right</b>/<b>down</b> arrow keys adjust the dial's <a href="qabstractslider.html#value-prop">value</a> by the defined <a href="qabstractslider.html#singleStep-prop">singleStep</a>, <b>Page Up</b> and <b>Page Down</b> by the defined <a href="qabstractslider.html#pageStep-prop">pageStep</a>, and the <b>Home</b> and <b>End</b> keys set the value to the defined <a href="qabstractslider.html#minimum-prop">minimum</a> and <a href="qabstractslider.html#maximum-prop">maximum</a> values.</p>
<p><table align="center" cellpadding="2" cellspacing="1" border="0">
<tr valign="top" class="odd"><td><img src="images/plastique-dial.png" alt="Screenshot of a dial in the Plastique widget style" /></td><td><img src="images/windowsxp-dial.png" alt="Screenshot of a dial in the Windows XP widget style" /></td><td><img src="images/macintosh-dial.png" alt="Screenshot of a dial in the Macintosh widget style" /></td></tr>
<tr valign="top" class="even"><td colspan="3">Dials shown in various widget styles (from left to right): <a href="gallery-plastique.html">Plastique</a>, <a href="gallery-windowsxp.html">Windows XP</a>, <a href="gallery-macintosh.html">Macintosh</a>.</td></tr>
</table></p>
<p>See also <a href="qscrollbar.html">QScrollBar</a>, <a href="qspinbox.html">QSpinBox</a>, <a href="qslider.html">QSlider</a>, <a href="guibooks.html#fowler">GUI Design Handbook: Slider</a>, and <a href="widgets-sliders.html">Sliders Example</a>.</p>
<hr />
<h2>Property Documentation</h2>
<h3 class="fn"><a name="notchSize-prop"></a>notchSize : const int</h3>
<p>This property holds the current notch size.</p>
<p>The notch size is in range control units, not pixels, and if possible it is a multiple of <a href="qabstractslider.html#singleStep-prop">singleStep</a>() that results in an on-screen notch size near <a href="qdial.html#notchTarget-prop">notchTarget</a>().</p>
<p>Access functions:</p>
<ul>
<li><div class="fn"/><b>int notchSize () const</b></li>
</ul>
<p>See also <a href="qdial.html#notchTarget-prop">notchTarget</a>() and <a href="qabstractslider.html#singleStep-prop">singleStep</a>().</p>
<h3 class="fn"><a name="notchTarget-prop"></a>notchTarget : <a href="qtglobal.html#qreal-typedef">qreal</a></h3>
<p>This property holds the target number of pixels between notches.</p>
<p>The notch target is the number of pixels <a href="qdial.html">QDial</a> attempts to put between each notch.</p>
<p>The actual size may differ from the target size.</p>
<p>The default notch target is 3.7 pixels.</p>
<p>Access functions:</p>
<ul>
<li><div class="fn"/><b>qreal notchTarget () const</b></li>
<li><div class="fn"/><b>void setNotchTarget ( double <i>target</i> )</b></li>
</ul>
<h3 class="fn"><a name="notchesVisible-prop"></a>notchesVisible : bool</h3>
<p>This property holds whether the notches are shown.</p>
<p>If the property is true, a series of notches are drawn around the dial to indicate the range of values available; otherwise no notches are shown.</p>
<p>By default, this property is disabled.</p>
<p>Access functions:</p>
<ul>
<li><div class="fn"/><b>bool notchesVisible () const</b></li>
<li><div class="fn"/><b>void setNotchesVisible ( bool <i>visible</i> )</b></li>
</ul>
<h3 class="fn"><a name="wrapping-prop"></a>wrapping : bool</h3>
<p>This property holds whether wrapping is enabled.</p>
<p>If true, wrapping is enabled; otherwise some space is inserted at the bottom of the dial to separate the ends of the range of valid values.</p>
<p>If enabled, the arrow can be oriented at any angle on the dial. If disabled, the arrow will be restricted to the upper part of the dial; if it is rotated into the space at the bottom of the dial, it will be clamped to the closest end of the valid range of values.</p>
<p>By default this property is false.</p>
<p>Access functions:</p>
<ul>
<li><div class="fn"/><b>bool wrapping () const</b></li>
<li><div class="fn"/><b>void setWrapping ( bool <i>on</i> )</b></li>
</ul>
<hr />
<h2>Member Function Documentation</h2>
<h3 class="fn"><a name="QDial"></a>QDial::QDial ( <a href="qwidget.html">QWidget</a> * <i>parent</i> = 0 )</h3>
<p>Constructs a dial.</p>
<p>The <i>parent</i> argument is sent to the <a href="qabstractslider.html">QAbstractSlider</a> constructor.</p>
<h3 class="fn"><a name="dtor.QDial"></a>QDial::~QDial ()</h3>
<p>Destroys the dial.</p>
<h3 class="fn"><a name="initStyleOption"></a>void QDial::initStyleOption ( <a href="qstyleoptionslider.html">QStyleOptionSlider</a> * <i>option</i> ) const&nbsp;&nbsp;<tt> [protected]</tt></h3>
<p>Initialize <i>option</i> with the values from this <a href="qdial.html">QDial</a>. This method is useful for subclasses when they need a <a href="qstyleoptionslider.html">QStyleOptionSlider</a>, but don't want to fill in all the information themselves.</p>
<p>See also <a href="qstyleoption.html#initFrom">QStyleOption::initFrom</a>().</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2008 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt 4.3.5</div></td>
</tr></table></div></address></body>
</html>
